import request from '@/utils/request'

export const OrderApi = {

    /**
     *  创建订单
     * @returns
     */
    createOrder: (data) => {
        return request({
            url: '/manage/mall/order/createOrder',
            data,
            method: 'post'
        })
    },

    /**
     *  分页
     * @returns
     */
    getPage: (data) => {
        return request({
            url: '/manage/mall/order/getPage',
            data,
            method: 'post'
        })
    },

    /**
     *  获取订单详情
     * @returns
     */
    getOrderDetailByOrderNo: (orderNo) => {
        return request({
            url: '/manage/mall/order/getOrderDetailByOrderNo',
            params: {orderNo},
            method: 'get'
        })
    },

    /**
     *  确认订单
     * @returns
     */
    confirmOrder: (orderNo) => {
        return request({
            url: '/manage/mall/order/confirmOrder',
            params: {orderNo},
            method: 'get'
        })
    },

    /**
     *  订单支付
     * @returns
     */
    payOrder: (data) => {
        return request({
            url: '/manage/mall/order/payOrder',
            data,
            method: 'post'
        })
    },

    /**
     *  取消订单
     * @returns
     */
    cancelOrder: (orderNo) => {
        return request({
            url: '/manage/mall/order/cancelOrder',
            params: {orderNo},
            method: 'get'
        })
    },

    /**
     *  发货
     * @returns
     */
    shipments: (data) => {
        return request({
            url: '/manage/mall/order/shipments',
            data,
            method: 'post'
        })
    },

    /**
     *  完成订单
     * @returns
     */
    completeOrder: (orderNo) => {
        return request({
            url: '/manage/mall/order/completeOrder',
            params: {orderNo},
            method: 'get'
        })
    },

    /**
     *  未处理订单数
     * @returns
     */
    pendingOrder: () => {
        return request({
            url: '/manage/mall/order/pendingOrder',
            method: 'get'
        })
    },

    /**
     *  修改备注
     * @returns
     */
    updateServiceRemark: (data) => {
        return request({
            url: '/manage/mall/order/updateServiceRemark',
            data,
            method: 'post'
        })
    },
}
